<?php
declare (strict_types = 1);

namespace app\Common\controller;

use app\common\model\AdminAuthRuleModel;
use app\common\model\AdminModel;
use think\App;
use think\cache\driver\Redis;
use think\facade\Config;
use think\facade\Request;
use think\facade\View;
use app\common\controller\CommonBaseController;

/**
 * 后台控制器
 * Class AdminController
 * @package app\Common\controller
 */
class AdminBaseController extends CommonBaseController
{
    public  $admin_user = [];

    public function __construct(App $app)
    {
        parent::__construct($app);

        $token   = Request::header('Authorization');
        if($token && empty($admin_user)){
            // 通过验证token保存admin信息
            $res = checkToken($token);
            if($res['status'] == 200 && isset($res['data']['uid'])){
                $this->admin_user = AdminModel::findByUsername('id', $res['data']['uid']);
            }
        }



    }

}
